package com.mini.rpc.provider.facade;

import com.mini.rpc.provider.annotation.RpcService;

import java.util.Date;

@RpcService(serviceInterface = HelloFacade.class, serviceVersion = "1.0.0")
public class HelloFacadeImpl implements HelloFacade {
    @Override
    public String hello(String name) {
        return "hello" + name;
    }

    @Override
    public void responseError() {
        throw new RuntimeException("An uncheck exception occurred inside the provider");
    }

    @Override
    public void responseCheckError() throws Exception {
        throw new Exception("Error: An check exception occurred inside the provider");
    }

    @Override
    public String responseTimeout() {
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return new Date().toString();
    }
}
